﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:TreeView">

    <!-- TreeViewCheckBox -->
	<Style TargetType="local:TreeViewCheckBox">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:TreeViewCheckBox">
					<Canvas x:Name="RootElement" Background="#00ffffff">
						<Rectangle x:Name="ElementBackground" StrokeThickness="1" Stroke="#ff444444" RadiusX="1" RadiusY="1" Width="13" Height="13" Canvas.Left="0" Canvas.Top="0" Opacity="0.8">
							<Rectangle.Fill>
								<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
									<GradientStop Color="#ffd8d8d8" Offset="0.0" />
									<GradientStop Color="#ffffffff" Offset="1.0" />
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<Rectangle x:Name="ElementBackgroundHighlight" StrokeThickness="1" Stroke="#ff666666" RadiusX="1" RadiusY="1" Width="13" Height="13" Canvas.Left="0" Canvas.Top="0" Opacity="0.8" Visibility="Collapsed">
							<Rectangle.Fill>
								<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
									<GradientStop Color="#ffeeeeee" Offset="0.0" />
									<GradientStop Color="#ffffffff" Offset="1.0" />
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
                        <TextBlock x:Name="ElementCross" Canvas.Left="3" Canvas.Top="-1" Text="X" FontSize="10" FontWeight="Bold" Visibility="Visible" Foreground="#ff000000" Opacity=".8" />
						<TextBlock x:Name="ElementText" Canvas.Left="30" Canvas.Top="2" Text="" FontFamily="Arial" />
						<Rectangle x:Name="ElementFocused" Canvas.Top="0" Canvas.Left="0" Stroke="#666666" StrokeDashArray=".1 2" StrokeDashCap="Round" StrokeThickness="1" Opacity="0.7" />
					</Canvas>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<!-- End TreeViewCheckBox -->
    
	<!-- TreeViewExpander -->
	<Style TargetType="local:TreeViewExpander">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:TreeViewExpander">
					<Canvas x:Name="RootElement" Background="#00ffffff">
						<Rectangle x:Name="ElementBackground" StrokeThickness="1" Stroke="#ff444444" RadiusX="5" RadiusY="5" Width="11" Height="11"  Opacity="0.8" Canvas.Left="1" Canvas.Top="1">
							<Rectangle.Fill>
								<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
									<GradientStop Color="#ffffffff" Offset="0.0" />
									<GradientStop Color="#ffeeeeee" Offset="1.0" />
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>

                        <Path x:Name="ElementPlus" Height="4" Width="6" Canvas.Left="3.5" Canvas.Top="5" Fill="#00FFFFFF" Stretch="Fill" Stroke="#FF000000" Data="M31.625,7 L28.125,10.875 L25,7" Opacity=".8" />
                        <Path x:Name="ElementMinus" Height="4" Width="6" Canvas.Left="3.5" Canvas.Top="4" Fill="#00FFFFFF" Stretch="Fill" Stroke="#FF000000" Data="M30.796877,11.197908 L27.815626,7.322916 L24.999998,11.197908" Opacity=".8" />
                    </Canvas>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<!-- End TreeViewExpander -->
	
	<!-- TreeView -->
	<Style TargetType="local:TreeView">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:TreeView">
					<Canvas x:Name="RootElement" Background="#00ffffff">
						<Canvas.Triggers>
							<EventTrigger RoutedEvent="Canvas.Loaded">
								<BeginStoryboard>
									<Storyboard x:Name="ElementTimer">
										<DoubleAnimation BeginTime="00:00:00" Duration="00:00:0.02" Storyboard.TargetName="TreeViewRect" Storyboard.TargetProperty="Width" />
									</Storyboard>
								</BeginStoryboard>
							</EventTrigger>
						</Canvas.Triggers>
						<Rectangle Visibility="Visible" x:Name="TreeViewRect" Width="1" Height="1" />
						
						<ScrollViewer x:Name="ElementContainer" Canvas.Left="1" Canvas.Top="1" Width="200" Height="200" BorderThickness="1" Background="#ffffffff">
							<ScrollViewer.Content>
								<Canvas x:Name="ElementChildren" VerticalAlignment="Top" HorizontalAlignment="Left" />
							</ScrollViewer.Content>
						</ScrollViewer>
					</Canvas>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
    <!-- End TreeView -->
	
	<!-- TreeViewNode -->
	<Style TargetType="local:TreeViewNode">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:TreeViewNode">
					<Canvas x:Name="RootElement" Background="#00ffffff">
						<Rectangle x:Name="ElementBackground" StrokeThickness="0.5" Stroke="#FF0000FF" RadiusX="3" RadiusY="3" Width="25" Height="65" Canvas.Left="0" Canvas.Top="0" Cursor="Hand" Visibility="Collapsed">
							<Rectangle.Fill>
								<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Color="#FFDCE5EC" Offset="0.0" />
                                    <GradientStop Color="#FF7AA7BB" Offset="0.371" />
                                    <GradientStop Color="#FF617BA1" Offset="0.589" />
                                    <GradientStop Color="#FF265D86" Offset="1.0" />
                                </LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<local:TreeViewExpander x:Name="ElementExpand" Cursor="Hand" /> <!--DoubleSignLogic="True"-->
						<Image x:Name="ElementIcon" Canvas.Left="14" Canvas.Top="0" Cursor="Hand" MaxHeight="16" MaxWidth="16" MinHeight="0" MinWidth="0" Stretch="Uniform" />
						<TextBox x:Name="ElementInput" Canvas.Left="34" Padding="2" Visibility="Collapsed" BorderThickness="0.5" />
						<TextBlock x:Name="ElementText" Text="" Canvas.Left="34" Canvas.Top="1" Cursor="Hand" Foreground="#ff000000" />
						<TextBlock x:Name="ElementSelectedText" Text="" Canvas.Left="34" Canvas.Top="1" Cursor="Hand" Foreground="#ffffffff" Visibility="Collapsed" />
					</Canvas>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<!-- End TreeViewNode -->
</ResourceDictionary>